package com.allnas.jpa.web;

import com.allnas.jpa.entity.User;
import com.allnas.jpa.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhaojin
 */
@RequestMapping("user")
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class UserController {
    private final UserService userService;

    @PostMapping("save")
    public String save(User user){
        userService.save(user);
        return "success";
    }
}
